import request from '../utils/request'

// 获取音乐列表
export const getMusicList = () => request.get('/music/getMusicList')

// 喜欢音乐
export const likeMusic = (musicId) => request.post(`/lovemusic/likeMusic?musicId=${musicId}`)

// 搜索音乐
export const searchMusic = (musicName) => request.get(`/music/searchMusic?musicName=${musicName}`)

// 上传音乐
export const uploadMusic = (formData, onProgress) => {
  return request.request({
    url: '/music/uploadMusic',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    onUploadProgress: onProgress
  })
}
// 删除音乐
export const deleteMusic = (ids) => request.post(`/music/deleteMusic?ids=${ids}`)
